Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid creating huge duplicate of canonicalized plans for CometNativeExec #639

Merged
merged 9 commits into from
Jul 8, 2024

Conversation

viirya
Copy link
Member

@viirya viirya commented Jul 7, 2024

Which issue does this PR close?

Closes #594.

Rationale for this change

I encountered OOM issue when trying to enable columnar shuffle for TPCDS queries in #613. I ran memory profiling and found that a lot of Spark expressions are allocated, e.g., AttributeReference:

Screenshot 2024-07-07 at 12 54 50 PM

It seems caused by the recursively canonicalization in canonicalizePlans on the original plan parameter. I think it is because when we transform the query plan, original plans in each operator could reference mix of Spark and Comet plans. When the canonical plans are required, it produces huge duplicate of canonicalized plans for each query snippets.

We don't need to rely on the original plan to compare canonical plans of Comet. This patch simply changes the canonical plan of the original plan to null.

What changes are included in this PR?

How are these changes tested?

@viirya viirya marked this pull request as draft July 7, 2024 21:59
@viirya viirya changed the title fix: Remove original plan parameter from CometNativeExec fix: Avoid creating huge duplicate of canonicalized plans for CometNativeExec Jul 8, 2024
@viirya viirya marked this pull request as ready for review July 8, 2024 02:15
@viirya viirya requested a review from andygrove July 8, 2024 03:13
@viirya viirya requested a review from kazuyukitanimura July 8, 2024 03:13
@viirya viirya merged commit b924aeb into apache:main Jul 8, 2024
73 checks passed
@viirya
Copy link
Member Author

viirya commented Jul 8, 2024

Merged. Thanks @andygrove

himadripal pushed a commit to himadripal/datafusion-comet that referenced this pull request Sep 7, 2024
…tiveExec (apache#639)

* fix: Remove original plan parameter from CometNativeExec

* Revert "fix: Remove original plan parameter from CometNativeExec"

This reverts commit b272551.

* More

* Revert "Revert "fix: Remove original plan parameter from CometNativeExec""

This reverts commit 722dc07.

* More

* More

* Fix

* Fix diffs

* Update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TPC-DS causes OOM
3 participants